/******************************************************************
*
* Copyright 2010 Darshan M Sonde
*
* This file is part of ddots.
*
* ddots is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ddots is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ddots.  If not, see <http://www.gnu.org/licenses/>.
*
*********************************************************************/

#ifndef LEVEL1_H
#define LEVEL1_H

#include "engineinterface.h"

#include <QString>
#include <QtCore>

class Level1Engine : public QObject,
               public EngineInterface
{
    Q_OBJECT
    Q_INTERFACES(EngineInterface);
public:
    Level1Engine();
    QString name(){ return mName; }
    void initGame(int rows, int cols);
    bool doMove(int startRow, int startCol, int endRow, int endCol);
    bool getMove(int &startRow, int &startCol, int &endRow, int &endCol);
private:
    bool canCompleteBox(int &startRow,int &startCol, int &endRow, int &endCol);
    int checkBox(int startRow,int startCol);

    QLine topLine(int startRow,int startCol);
    QLine bottomLine(int startRow,int startCol);
    QLine rightLine(int startRow,int startCol);
    QLine leftLine(int startRow,int startCol);

private:
    QString mName;
    int mRows;
    int mColumns;
    QList<QLine> mValidMoves;
};

#endif

